Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 10: Controlling Appearance with Materials

../ch10/10fig08.gif
Figure 10.8

A blinking sphere.

10fig08.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
    # Blinking ball
        Shape {
            appearance Appearance {
                material DEF BallColor Material {
                    diffuseColor 0.4 0.4 0.4
                }
            }
            geometry Sphere { }
        },
    # Animation clock
        DEF Clock TimeSensor {
            cycleInterval 1.0
            loop TRUE
        },
    # Animation path
        DEF ColorPath ColorInterpolator {
            key [ 0.0, 0.5, 0.5, 1.0 ]
            keyValue [
                0.0 1.0 0.0,  0.0 1.0 0.0,
                0.0 0.0 1.0,  0.0 0.0 1.0,
            ]
        }
    ]
}
ROUTE Clock.fraction_changed  TO ColorPath.set_fraction
ROUTE ColorPath.value_changed TO BallColor.set_emissiveColor